package lab01;
import java.util.Scanner;
public class Test12 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请用户输入想要判断的1-9999之间的数字：");
        int integer = sc.nextInt();
        int individual = 0;//定义个位
        int ten = 0;//定义十位
        int hundred = 0;//定义百位
        int thousand = 0;//定义千位
        individual = integer % 1000 % 100 % 10;//取出个位数值
        ten = integer % 1000 % 100 / 10;//取出十位数值
        hundred = integer % 1000 / 100;//取出百位数值
        thousand = integer / 1000;//取出千位数值
        //判断位数
        if (thousand != 0) {
            System.out.println("这是一个四位数。");
        }
        if (thousand == 0 & hundred != 0) {
            System.out.println("这是一个三位数。");
        }
        if (thousand == 0 & hundred == 0 & ten != 0) {
            System.out.println("这是一个两位数。");
        }
        if (thousand == 0 & hundred == 0 & ten == 0 & individual != 0) {
            System.out.println("这是一个个位数。");
        }
        //判断是否是回文数
        if (thousand == individual & hundred == ten || individual == ten & hundred == thousand || hundred == individual & thousand == 0){
            System.out.println("这是一个回文数。");
        } else {
            System.out.println("这不是一个回文数。");
        }
    }
}
